<?php

class DB_SEX extends ORM_Table {
    
    static protected $table_name = 'sex';
    
    static public function getTableName($params = null) {
        return self::$table_name;
    }
    
    /**
     *
     * @param type $weibo_id
     * @param type $type
     * @param type $nums 
     */
    static function saveSex($weibo_id, $type='m', $nums){
        $sex    = ORM_Finder::findOne('DB_SEX', array('weibo_id'=>$weibo_id, 'gender'=>$type));
        if(!$sex){
            $sex    = new DB_SEX();
        }
        $sex->setWeiboId($weibo_id);
        $sex->setGender($type);
        $sex->setNums($nums);
        $sex->save();        
    }
}

?>
